﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace RainingNight.MyBaseObject
{
    enum TEAM
    {
        PLAYER = 1, ENEMY = 2,
    };

    abstract class MyDynamicObject : MyObject
    {


        private TEAM m_Team;

        private MoveAbillity m_MoveAbility;

        public MyDynamicObject(TEAM team, int col, Rectangle baserect,Vector2? position = null)
            : base(col, baserect,position)
        {
            Team = team;
            MAbility = new MoveAbillity();
        }
        public MyDynamicObject(int team, int col, Rectangle baserect,Vector2? position = null)
            : base(col, baserect,position)
        {
            try
            {
                Team = (TEAM)team;
                MAbility = new MoveAbillity();
            }
            catch
            {
                Exception ex = new Exception("cant convert int to MyDynamicObecjt.TEAM");
                throw ex;
            }
        }

        public TEAM Team
        {
            get { return m_Team; }
            protected set { m_Team = value; }
        }



        public MoveAbillity MAbility
        {
            get { return m_MoveAbility; }
            set { m_MoveAbility = value; }
        }

        public void Move(GameTime gametime)
        {
            Timer.TimeRun(gametime);
            if (this.Timer.StopWatch(GlobalConstant.TimeFrame, gametime))
            {
                Sprite.setFrame();
                this.Sprite.Position += this.MAbility.Speed * GlobalConstant.TimeFrame;
            }
        }

        //protected abstract void setFrame();
    }
}
